#!/bin/bash -e

function info() {
echo Usage: `basename $0` '[-s sample_name] in.sam'
exit 2
}

while getopts  ":p:f:s:" opt; do
	case  $opt  in
		p) out_prefix=$OPTARG;;
        s) sample_name=$OPTARG;;
		f) suffix=$OPTARG;;
		*) info;;
	esac
done
shift $(($OPTIND - 1))


if [ $# -lt 1 ]; then info; fi

. $var

echo;echo Add Read Group
$java_run/picard/AddOrReplaceReadGroups.jar \
VALIDATION_STRINGENCY=LENIENT \
INPUT=$1  \
OUTPUT=$out_prefix.rg.bam  \
CREATE_INDEX=true \
RGID=$sample_name RGSM=$sample_name RGLB=$sample_name RGPL=illumina RGPU=xunit

. $cmd_done